<?php
const PAPER_CORE_PATH = __DIR__;
define("PAPER_ROOT_PATH", dirname(PAPER_CORE_PATH));
if (!defined("PAPER_APP")) {
    define("PAPER_APP", "app");
}
const PAPER_APP_PATH = PAPER_ROOT_PATH . DIRECTORY_SEPARATOR . PAPER_APP;

//监测是否安装了composer
if (file_exists(PAPER_ROOT_PATH . '/vendor/autoload.php')) {
    require PAPER_ROOT_PATH . '/vendor/autoload.php';
}
spl_autoload_register(function ($class) {
    $classpath = PAPER_ROOT_PATH . DIRECTORY_SEPARATOR .
        str_replace("\\", DIRECTORY_SEPARATOR, $class) . '.php';
    if (!is_file($classpath)) {
        return;
    }
    require $classpath;
}, true, true);

//加载助手函数
require PAPER_CORE_PATH.DIRECTORY_SEPARATOR.'assistant.php';